package com.zzyl.controller;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.dto.AlertDataHandleDto;
import com.zzyl.dto.AlertDataPageQueryDto;
import com.zzyl.service.AlertDataService;
import com.zzyl.vo.AlertDataVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/alert-data")
public class AlertDataController {
    @Autowired
    AlertDataService service;

    @GetMapping("/pageQuery")
    @ApiOperation("6.1 分页查询报警数据")
    public ResponseResult<PageResponse<AlertDataVo>> pageQuery(AlertDataPageQueryDto dto) {
        PageResponse<AlertDataVo> pageResponse = service.pageQuery(dto);
        return ResponseResult.success(pageResponse);
    }

    @PutMapping("/handleAlertData/{id}")
    @ApiOperation("6.2 处理设备报警数据")
    public ResponseResult<Void> handleAlertData(@PathVariable Long id, @RequestBody AlertDataHandleDto dto) {
        service.handleAlertData(id, dto);
        return ResponseResult.success();
    }
}
